package com.tao.lab.event.dispath;

import android.os.Looper;

import com.tao.lab.Poster;
import com.tao.lab.event.dispath.poster.HandlerPoster;

/**
 * @ProjectName: lab
 * @Package: com.tao.lab.event.dispath
 * @ClassName: MainThreadSupport
 * @Description: java类作用描述
 * @Author: wangxf
 * @CreateDate: 2022/5/6 13:43
 * @UpdateUser: 更新者
 * @UpdateDate: 2022/5/6 13:43
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public interface MainThreadSupport {
    boolean isMainThread();

    Poster createPoster(EventBus var1);

    public static class AndroidHandlerMainThreadSupport implements MainThreadSupport {
        private final Looper looper;

        public AndroidHandlerMainThreadSupport(Looper looper) {
            this.looper = looper;
        }

        public boolean isMainThread() {
            return this.looper == Looper.myLooper();
        }

        public Poster createPoster(EventBus eventBus) {
            return new HandlerPoster(eventBus, this.looper, 10);
        }
    }
}
